import { ElLoading } from 'element-plus';

let instance = null;

let loadingInstance = {
    open() {
        if (instance == null) {
            instance = ElLoading.service({
                lock: true,
                text: 'Loading',
                spinner: 'el-icon-loading',
                background: 'rgba(0, 0, 0, 0.4)',
            });
        }
        return this;
    },
    close() {
        if (instance != null) {
            instance.close();
            instance = null;
        }
    },
};
export default loadingInstance;
